<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>商品信息修改</title>
<link rel="stylesheet" href="../layui/css/layui.css">
<link rel="stylesheet" href="../layer/theme/default/layer.css">
<script type="text/javascript" src="../layer/layer.js"></script>
<script type="text/javascript" src="../js/jquery-3.3.1.js"></script>
<script src="../layui/layui.all.js"></script>
<script src="../layer/mobile/layer.js"></script>
</head>
<body style="text-align:center;margin:0 auto;width:280px;height:390px;">
<script type="text/javascript">

$(function(){
	var vv = localStorage["name"];
	document.getElementById("cid").value=vv;
})
</script>
<form id="form">
	<div class="layui-form-item">
		<label class="layui-form-label">商品名：</label>
	    <div class="layui-input-block">
	      <input type="text" name="name" placeholder="请输入商品名" autocomplete="off" class="layui-input">
	    </div>
    </div>
	<div class="layui-form-item">
		<label class="layui-form-label">商品单价：</label>
	    <div class="layui-input-block">
	      <input type="text" name="price" placeholder="输入商品单价" autocomplete="off" class="layui-input">
	    </div>
    </div>
	<div class="layui-form-item">
		<label class="layui-form-label">商品详情：</label>
	    <div class="layui-input-block">
	      <input type="text" name="remake"  placeholder="输入商品详情" autocomplete="off" class="layui-input">
	    </div>
    </div>
	<div class="layui-form-item">
		<label class="layui-form-label">商品分类：</label>
	    <div class="layui-input-block">
	      <input type="text" name="class"  placeholder="输入商品分类" autocomplete="off" class="layui-input">
	    </div>
    </div>
	<div class="layui-form-item">
		<label class="layui-form-label">商品图片展示路径：</label>
	    <div class="layui-input-block">
	      <input type="text" name="pic"  placeholder="商品图片展示路径" autocomplete="off" class="layui-input">
	    </div>
    </div>
	<input type="hidden" name="id"  id="cid" value="" />
</form>
<button class="layui-btn" id="btn">提交</button>
<script type="text/javascript">
	$(function(){
		//点击事件--触发ajax请求更新用户信息
		$("#btn").click(function(){
			$.post("a.commodityupd", $("form#form").serialize(),function(data){
				var dd=JSON.parse(data);
				if(dd.code=="1"){
					alert("修改成功");
					parent.location.reload();
				}
			})

		})
	})

</script>
</body>
</html>